﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NewViews.Models;
namespace NewViews.Controllers
{
    public class HomeController : Controller
    {
        EShopDataEntities5 dbEntities = new EShopDataEntities5();
        //
        // GET: /Home/

        public ActionResult index()
        {
           
            var products = dbEntities.Products;
            ViewBag.product = products.ToList();
            return View();
        }
        public ActionResult contact()
        {
            return View();
        }
        public ActionResult AddReview(ReView user_review)
        {
            dbEntities.ReViews.Add(user_review);
            dbEntities.SaveChanges();
            return RedirectToAction("Index", "Home");
        }
        public ActionResult About()
        {
            return View();
        }
        public ActionResult indexOut()
        {

            
            var products = dbEntities.Products;
            ViewBag.product = products.ToList();
            return View();
        }
        public ActionResult details(int id=0)
        {

            var products = dbEntities.Products;
            ViewBag.prod = products.Find(id);
            Product dbPprod = products.Find(id);
            if (dbPprod == null)
            {
                return HttpNotFound();
            }
            return View(dbPprod);
        }
        public ActionResult Laptops()
        {
           
            var products = dbEntities.Products;
            ViewBag.product = products.ToList();
            return View();
        }
        public ActionResult WebCam()
        {

            var products = dbEntities.Products;
            ViewBag.product = products.ToList();
            return View();
        }
        public ActionResult Mobile()
        {

            var products = dbEntities.Products;
            ViewBag.product = products.ToList();
            return View();
        }
       
    }
}
